package com.ccnf.controller;


import com.ccnf.core.bean.ResponseWithData;
import com.ccnf.service.ExpoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 展会信息表 前端控制器
 * </p>
 *
 * @author developer
 * @since 2018-10-09
 */
@RestController
@RequestMapping("/v1/expo")
@Api(value = "ExpoController", description = "展会相关API")
public class ExpoController extends BaseController {
    @Autowired
    private ExpoService expoService;

    @ApiOperation("获取展会信息")
    @GetMapping
    public ResponseWithData expoInfo() {
        return ResponseWithData.success(expoService.findExpoByExpoId(getTokenParams()));
    }

    @ApiOperation("通过展会ID获取展会信息")
    @GetMapping("channelCode/{channelCode}")
    public ResponseWithData expoInfo(@PathVariable String channelCode) {
        return ResponseWithData.success(expoService.findExpoByChanelCode(channelCode));
    }

    @ApiOperation("开启开放创建")
    @GetMapping("open/create")
    public ResponseWithData openCreate(@RequestParam(required = false) Integer isOpen) {
        return ResponseWithData.success(expoService.openCreate(isOpen, getTokenParams()));
    }

    @ApiOperation("客服审核")
    @GetMapping("auth/audit")
    public ResponseWithData authAudit(@RequestParam(required = false) Integer isOpen) {
        return ResponseWithData.success(expoService.authAudit(isOpen, getTokenParams()));
    }
}
